﻿using System;

namespace XTengine.ComponentModel
{
    public class TimeSpanConverter : TypeConverter<TimeSpan>
    {
        public override TimeSpan ConvertFrom(string value)
        {
            TimeSpan result;
            if (TimeSpan.TryParse(value, out result))
            {
                return result;
            }

            return default(TimeSpan);
        }

        public override string ConvertTo(TimeSpan value)
        {
            return value.ToString();
        }
    }
}